LLM 25일 코스 - Day 10: 오픈소스 LLM 생태계 총정리

Day 10: 오픈소스 LLM 생태계 총정리

Llama와 Mistral 외에도 수많은 오픈소스 LLM이 경쟁하고 있습니다. 각 모델의 특징을 알면 프로젝트에 최적의 모델을 선택할 수 있습니다.

글로벌 오픈소스 LLM 비교

모델개발사크기강점라이선스
Qwen 2.5알리바바0.5B~72B다국어, 코딩, 수학Apache 2.0
DeepSeek V2DeepSeek236B (21B 활성)MoE, 가성비MIT
DeepSeek-Coder V2DeepSeek236B코딩 특화, 338개 언어MIT
Phi-3Microsoft3.8B / 7B / 14B초소형 고성능MIT
Yi-1.501.AI6B / 9B / 34B중국어+영어 강점Apache 2.0
Command R+Cohere104BRAG 특화, 다국어CC-BY-NC
Falcon 2TII (UAE)11B아랍어 강점Apache 2.0

한국어 특화 모델

모델개발사크기특징
SOLARUpstage10.7BDUS(Depth Up-Scaling) 기법
EXAONE 3.0LG AI Research7.8B한국어+영어 이중 언어
HyperCLOVA XNAVER비공개한국어 최강, 비공개
Polyglot-KoEleutherAI1.3B~12.8B한국어 사전학습
KoAlpaca커뮤니티다양Alpaca 한국어 파인튜닝

모델 선택 가이드

def recommend_model(task, budget, korean_priority):
    """태스크와 조건에 따른 모델 추천"""
    recommendations = {
        ("coding", "low", False): "DeepSeek-Coder-V2-Lite (16B)",
        ("coding", "high", False): "DeepSeek-Coder-V2 (236B)",
        ("general", "low", False): "Phi-3 Mini (3.8B)",
        ("general", "medium", False): "Qwen 2.5 72B",
        ("general", "low", True): "EXAONE 3.0 7.8B",
        ("general", "medium", True): "SOLAR 10.7B + 한국어 파인튜닝",
        ("general", "high", True): "Qwen 2.5 72B (한국어 성능 우수)",
        ("math", "low", False): "Qwen 2.5 Math 7B",
        ("math", "high", False): "DeepSeek-Math 7B",
        ("rag", "medium", False): "Command R+ (104B)",
    }

    key = (task, budget, korean_priority)
    return recommendations.get(key, "Qwen 2.5 또는 Llama 3.1 추천")

# 사용 예시
print(recommend_model("coding", "low", False))
print(recommend_model("general", "low", True))
print(recommend_model("general", "medium", False))

Qwen 2.5 실행 예시

# Ollama: ollama pull qwen2.5:7b
import ollama

response = ollama.chat(
    model="qwen2.5:7b",
    messages=[
        {"role": "system", "content": "한국어로 답해주세요."},
        {"role": "user", "content": "피보나치 수열을 생성하는 제너레이터를 작성해주세요."},
    ],
)
print(response["message"]["content"])

# HuggingFace 방식
# from transformers import AutoModelForCausalLM, AutoTokenizer
# model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")

한국어 모델 비교 실험

import ollama

# 한국어 성능 비교 테스트
korean_prompts = [
    "한국의 사계절 특징을 각각 한 문장으로 설명해주세요.",
    "'가는 말이 고우면 오는 말이 곱다'라는 속담의 의미를 설명해주세요.",
    "조선시대 과거 시험 제도에 대해 간략히 설명해주세요.",
]

models_to_test = ["llama3.1:8b", "qwen2.5:7b", "gemma2:9b"]

for prompt in korean_prompts:
    print(f"\n질문: {prompt}")
    print("=" * 60)
    for model_name in models_to_test:
        try:
            response = ollama.chat(
                model=model_name,
                messages=[{"role": "user", "content": f"한국어로 답해주세요. {prompt}"}],
            )
            answer = response["message"]["content"][:150]
            print(f"  [{model_name}] {answer}...")
        except Exception:
            print(f"  [{model_name}] 모델 미설치")

오픈소스 LLM 트렌드 정리

트렌드설명
소형 모델 강세Phi-3, Gemma 2 등 3~9B 모델이 13B급 성능 달성
MoE 확산DeepSeek, Mixtral 등 효율적인 MoE 모델 증가
코딩 특화DeepSeek-Coder, CodeLlama 등 코딩 전문 모델
다국어 강화Qwen, EXAONE 등 비영어권 언어 성능 향상
라이선스 완화Apache 2.0, MIT 등 상업 사용 가능 라이선스 확대

오늘의 연습문제

  1. Qwen 2.5 7B를 Ollama로 설치하고, 한국어 코딩 질문 3개를 보내보세요. Llama 3.1 8B와 비교하여 어떤 모델이 더 나은지 평가하세요.
  2. SOLAR 모델의 DUS(Depth Up-Scaling) 기법이 무엇인지 조사하고, 일반적인 모델 확장 방법과 비교해보세요.
  3. 본인의 프로젝트에 가장 적합한 오픈소스 모델을 선택하고 그 이유를 정리해보세요. (태스크, 예산, 하드웨어, 언어 요구사항 고려)

이 글이 도움이 되었나요?